<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <input id="inputEL" type="text" name="" age="20">
  <script>
    const inputEL = document.getElementById('inputEL');

    // 视觉
    console.log(inputEL.hasAttribute('id'));//true
    console.log(inputEL.hasAttribute('class'));//fasle
    console.log(inputEL.hasAttribute('age'));//true
    console.log(inputEL.getAttribute('age'));
    console.log(inputEL.getAttribute('id'));
    console.log(inputEL.setAttribute('value', 'hello'));
    console.log(inputEL.setAttribute('gender', 'boy'));
    inputEL.removeAttribute('age')
    inputEL.removeAttribute('name')

  </script>
</body>

</html>